﻿// ------------------------------------------------------------------------------------------------
// summary: This file contains individual parsers as plugins for handling system level 
//			features like control-flow e..g if, while, for, try, break, continue, return etc.
// version: 0.9.8.10
// author:  kishore reddy
// date:	Saturday, December 22, 2012
// ------------------------------------------------------------------------------------------------
function ExprPlugin()
{
}
ExprPlugin.prototype._parser = null;
ExprPlugin.prototype.StartTokens = [ ];
ExprPlugin.prototype.IsCodeBlockSupported = false;
ExprPlugin.prototype.IsStatement = false;
ExprPlugin.prototype.IsSystemLevel = true;
ExprPlugin.prototype.IsEndOfStatementRequired = false;
ExprPlugin.prototype.IsAutoMatched = false;
ExprPlugin.prototype.ConfigureAsSystemStatement(bool isCodeBlockSupported, bool isTerminatorSupported, string token)
{
    this.StartTokens.push(token);
    this.IsCodeBlockSupported = isCodeBlockSupported;
    this.IsStatement = true;
    this.IsSystemLevel = true;
    this.IsEndOfStatementRequired = isTerminatorSupported;
    this.IsAutoMatched = true;
};


// Plugin: 15 - NewExpr
function NewPlugin()
{	
	this.ConfigureAsSystemStatement(false, false, "new");		
}
NewPlugin.prototype = new ExprPlugin();	
NewPlugin.prototype.Parse = function()
{
	return this.ExpParser.OnParseNew();
};
NewPlugin.prototype.OnParseComplete = function(node)
{
	return this.ExpParser.OnParseNewComplete(node);
};


	// Plugin: 18 - BreakExpr
function BreakPlugin()
{	
	this.ConfigureAsSystemStatement(false, true, "break");		
}
BreakPlugin.prototype = new ExprPlugin();	
BreakPlugin.prototype.Parse = function()
{
	return this.ExpParser.OnParseBreak();
};
BreakPlugin.prototype.OnParseComplete = function(node)
{
	return this.ExpParser.OnParseBreakComplete(node);
};


	// Plugin: 19 - ContinueExpr
function ContinuePlugin()
{	
	this.ConfigureAsSystemStatement(false, true, "continue");		
}
ContinuePlugin.prototype = new ExprPlugin();	
ContinuePlugin.prototype.Parse = function()
{
	return this.ExpParser.OnParseContinue();
};
ContinuePlugin.prototype.OnParseComplete = function(node)
{
	return this.ExpParser.OnParseContinueComplete(node);
};


	// Plugin: 20 - ForEachExpr
function ForEachPlugin()
{	
	this.ConfigureAsSystemStatement(true, false, "for");		
}
ForEachPlugin.prototype = new ExprPlugin();	
ForEachPlugin.prototype.Parse = function()
{
	return this.ExpParser.OnParseForEach();
};
ForEachPlugin.prototype.OnParseComplete = function(node)
{
	return this.ExpParser.OnParseForEachComplete(node);
};


	// Plugin: 21 - ForExpr
function ForPlugin()
{	
	this.ConfigureAsSystemStatement(true, false, "for");		
}
ForPlugin.prototype = new ExprPlugin();	
ForPlugin.prototype.Parse = function()
{
	return this.ExpParser.OnParseFor();
};
ForPlugin.prototype.OnParseComplete = function(node)
{
	return this.ExpParser.OnParseForComplete(node);
};


	// Plugin: 22 - FunctionDeclareExpr
function FunctionDeclarePlugin()
{	
	this.ConfigureAsSystemStatement(true, false, "function");		
}
FunctionDeclarePlugin.prototype = new ExprPlugin();	
FunctionDeclarePlugin.prototype.Parse = function()
{
	return this.ExpParser.OnParseFunctionDeclare();
};
FunctionDeclarePlugin.prototype.OnParseComplete = function(node)
{
	return this.ExpParser.OnParseFunctionDeclareComplete(node);
};


	// Plugin: 23 - IfExpr
function IfPlugin()
{	
	this.ConfigureAsSystemStatement(true, false, "if");		
}
IfPlugin.prototype = new ExprPlugin();	
IfPlugin.prototype.Parse = function()
{
	return this.ExpParser.OnParseIf();
};
IfPlugin.prototype.OnParseComplete = function(node)
{
	return this.ExpParser.OnParseIfComplete(node);
};


	// Plugin: 24 - LambdaExpr
function LambdaPlugin()
{	
	this.ConfigureAsSystemStatement(true, false, "function");		
}
LambdaPlugin.prototype = new ExprPlugin();	
LambdaPlugin.prototype.Parse = function()
{
	return this.ExpParser.OnParseLambda();
};
LambdaPlugin.prototype.OnParseComplete = function(node)
{
	return this.ExpParser.OnParseLambdaComplete(node);
};


	// Plugin: 25 - ReturnExpr
function ReturnPlugin()
{	
	this.ConfigureAsSystemStatement(false, true, "return");		
}
ReturnPlugin.prototype = new ExprPlugin();	
ReturnPlugin.prototype.Parse = function()
{
	return this.ExpParser.OnParseReturn();
};
ReturnPlugin.prototype.OnParseComplete = function(node)
{
	return this.ExpParser.OnParseReturnComplete(node);
};


	// Plugin: 26 - ThrowExpr
function ThrowPlugin()
{	
	this.ConfigureAsSystemStatement(false, true, "throw");		
}
ThrowPlugin.prototype = new ExprPlugin();	
ThrowPlugin.prototype.Parse = function()
{
	return this.ExpParser.OnParseThrow();
};
ThrowPlugin.prototype.OnParseComplete = function(node)
{
	return this.ExpParser.OnParseThrowComplete(node);
};


	// Plugin: 27 - TryCatchExpr
function TryCatchPlugin()
{	
	this.ConfigureAsSystemStatement(true, false, "try");		
}
TryCatchPlugin.prototype = new ExprPlugin();	
TryCatchPlugin.prototype.Parse = function()
{
	return this.ExpParser.OnParseTryCatch();
};
TryCatchPlugin.prototype.OnParseComplete = function(node)
{
	return this.ExpParser.OnParseTryCatchComplete(node);
};


	// Plugin: 28 - WhileExpr
function WhilePlugin()
{	
	this.ConfigureAsSystemStatement(true, false, "while");		
}
WhilePlugin.prototype = new ExprPlugin();	
WhilePlugin.prototype.Parse = function()
{
	return this.ExpParser.OnParseWhile();
};
WhilePlugin.prototype.OnParseComplete = function(node)
{
	return this.ExpParser.OnParseWhileComplete(node);
};


	// Plugin: 29 - VariableExpr
function VariablePlugin()
{	
	this.ConfigureAsSystemStatement(false, false, "@ident");		
}
VariablePlugin.prototype = new ExprPlugin();	
VariablePlugin.prototype.Parse = function()
{
	return this.ExpParser.OnParseVariable();
};
VariablePlugin.prototype.OnParseComplete = function(node)
{
	return this.ExpParser.OnParseVariableComplete(node);
};


	
			